package blog.caidabao.mapper;

import blog.caidabao.pojo.IndexArticle;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface IndexArticleMapper {
    @Select(" SELECT id, " +
            "article.article_title articleTitle, " +
            "article.article_desc articleDesc, " +
            "article.create_time createTime, " +
            "category.category_desc categoryDesc " +
            "FROM article,category WHERE " +
            "FIND_IN_SET(id,#{ids}) AND "+
            "article.`article_category_id`=category.`category_id` "+
            "ORDER BY FIND_IN_SET(id,#{ids}) ")
    List<IndexArticle> indexArticle(String ids);

    @Select(" SELECT id, " +
            "article.article_title articleTitle, " +
            "article.article_desc articleDesc, " +
            "article.create_time createTime, " +
            "category.category_desc categoryDesc " +
            "FROM article,category WHERE " +
            "article.`article_category_id`=category.`category_id` "+
            "AND article.article_category_id=#{id}")
    List<IndexArticle> findArticleByCategoryId(Integer id);
}
